package platform.standard;

import java.awt.Frame;
import java.awt.event.WindowEvent;
import java.awt.event.WindowListener;


import engine.Constants;
import engine.Engine;
import engine.Globals;

public final class MainWindow extends Frame {
	public static final int WINDOW_WIDTH = Constants.SCREEN_WIDTH;
	public static final int WINDOW_HEIGHT = Constants.SCREEN_HEIGHT;

	private static final long serialVersionUID = 1L;
	public MainWindow() {
		this.setSize(WINDOW_WIDTH, WINDOW_HEIGHT);
		//this.setLayout(null);
		this.setTitle(Constants.GAME_NAME + " " + Constants.VERISON_STRING);
		
		bindWindowListener();
		this.setVisible(true);
	}
	
	public void shutDown() {
		setVisible(false);
		dispose();
	}
	private void bindWindowListener() {
		WindowListener l = new WindowListener() {

			@Override
			public void windowActivated(WindowEvent arg0) {
			}

			@Override
			public void windowClosed(WindowEvent arg0) {
			}

			@Override
			public void windowClosing(WindowEvent arg0) {
				Globals.KillSwitch = true;
			}

			@Override
			public void windowDeactivated(WindowEvent arg0) {
			}

			@Override
			public void windowDeiconified(WindowEvent arg0) {
			}

			@Override
			public void windowIconified(WindowEvent arg0) {
			}

			@Override
			public void windowOpened(WindowEvent arg0) {
			}
		};
		this.addWindowListener(l);
	}
}